import request from '@/utils/request.js'

// table列表
export const keywordList = (data) => {
    return request({
        url: '/keyword/list',
        method: 'post',
        data: data
    })
}

// 关键词选择
export const keywordSelect = (id) => {
    return request({
        url: '/word/list/' + id,
        method: 'get',
    })
}

// 关键词新增
export const newKeyword = (data) => {
    return request({
        url: '/keyword',
        method: 'post',
        data: data
    })
}

// 关键词详情
export const keywordDetail = (id) => {
    return request({
        url: '/keyword/' + id,
        method: 'get',
    })
}

// 修改关键词
export const editKeyword = (data) => {
    return request({
        url: '/keyword',
        method: 'put',
        data: data
    })
}

// 关键词删除
export const keywordRowDel = (id) => {
    return request({
        url: `/keyword/${id}`,
        method: 'delete'
    })
}

// 关键词批量删除
export const keywordsDel = (ids) => {
    return request({
        url: `/keyword/batchDelete`,
        method: 'delete',
        data: ids
    })
}
// 关键词批量导出
export const keywordExport = (data) => {
    return request({
        url: `/keyword/export`,
        method: 'post',
        data: data,
        responseType: 'blob'//处理乱码问题，转化为blob类型
    })
}

// 关键词模版
export const keywordReload = () => {
    return request({
        url: '/keyword/reload',
        method:'post',
        headers:{'Content-Type':'multipart/form-data'},
        responseType: 'blob',
    })
}
